package com.example.demo.utils;

import io.netty.buffer.ByteBuf;
import io.netty.channel.Channel;


/**
 * create by lorne on 2018/3/13
 */
public class SocketUtils {

    public static void send(Channel ctx, final byte[] data) {
        if (ctx == null)
            return;

        final ByteBuf byteBufMsg = ctx.alloc().buffer(data.length);
        byteBufMsg.writeBytes(data);
        ctx.writeAndFlush(byteBufMsg);
    }
}
